package com.meritit.config.test;

public class NewThread implements Runnable {

	@Override
	public void run() {
		
		synchronized (this) {
			while(true) {
				try {
					wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println("自定义线程启动。。。");
			}
		}
		
	}
	
	public static void main(String[] args) {
		NewThread n = new NewThread();
		Thread t = new Thread(n);
		t.start();
		
		while(true) {
			synchronized (n) {
				System.out.println("主线程启动。。。");
				try {
					Thread.sleep(10);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				n.notify();
			}
		}
	}
}
